package com.block.common.service.impl;

import com.alibaba.fastjson.JSON;
import com.block.common.exception.NotifyExceptionService;
import com.block.common.model.dto.RequestTimeDTO;
import com.block.db.entity.SystemRequestTimeRecord;
import com.block.db.mapper.SystemRequestTimeRecordMapper;
import com.block.common.service.ISystemRequestTimeRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

import java.time.LocalDate;

/**
 * <p>
 * 系统请求时间记录 服务实现类
 * </p>
 *
 * @author 
 * @since 2024-01-08
 */
@Service
public class SystemRequestTimeRecordServiceImpl extends ServiceImpl<SystemRequestTimeRecordMapper, SystemRequestTimeRecord> implements ISystemRequestTimeRecordService {

    @Autowired
    NotifyExceptionService notifyExceptionService;

    @Async
    @Override
    public void saveRequestTime(RequestTimeDTO requestTimeDTO){
//        try {
//            SystemRequestTimeRecord timeRecord = new SystemRequestTimeRecord();
//            timeRecord.setDateInfo(LocalDate.now().toString());
//            timeRecord.setBizType(requestTimeDTO.getBizType());
//            timeRecord.setBizName(requestTimeDTO.getBizName());
//            timeRecord.setExecTime(requestTimeDTO.getExecTime());
//            timeRecord.setLineTime(requestTimeDTO.getLineTime());
//            timeRecord.setParamInfo(requestTimeDTO.getParamInfo());
//            timeRecord.setResultInfo(requestTimeDTO.getResultInfo());
//            timeRecord.setRemarkInfo(requestTimeDTO.getRemarkInfo());
//
//            this.save(timeRecord);
//        }catch (Exception exception){
//            exception.printStackTrace();
//            notifyExceptionService.notifyNoticeInfo("SYSTEM_REQUEST_RECORD", "系统请求时间记录", JSON.toJSONString(requestTimeDTO), exception);
//        }

    }

}
